/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.schedule.core.repository.entity;

import com.gitee.peigenlpy.actable.annotation.Column;
import com.gitee.peigenlpy.actable.annotation.Index;
import com.gitee.peigenlpy.actable.annotation.Table;
import com.gitee.peigenlpy.actable.annotation.Unique;
import com.gitee.peigenlpy.actable.constants.MySqlCharsetConstant;
import com.gitee.peigenlpy.actable.constants.MySqlEngineConstant;
import com.gitee.peigenlpy.actable.constants.MySqlTypeConstant;
import info.peigen.hotpot.common.core.enums.YesOrNo;
import info.peigen.hotpot.component.data.repository.beetlsql.entity.AbstractCreateTimeEntity;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;

/**
 * <b>(ScheduleNodeEntity)</b>
 * 定时任务节点
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/12/28
 */
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
@Table(name = "schedule_node", comment = "定时任务节点表", charset = MySqlCharsetConstant.UTF8MB4, engine = MySqlEngineConstant.InnoDB)
@org.beetl.sql.annotation.entity.Table(name = "schedule_node")
public class ScheduleNodeEntity extends AbstractCreateTimeEntity {
    @Column(name = "node_name", type = MySqlTypeConstant.VARCHAR, length = 30, comment = "节点名，多数情况是IP")
    @Index(value = "nodeName", columns = "node_name")
    @org.beetl.sql.annotation.entity.Column("node_name")
    String  nodeName;
    @Column(name = "ip", type = MySqlTypeConstant.VARCHAR, length = 30, isNull = false, comment = "ip")
    @Unique(value = "ip", columns = "ip")
    @org.beetl.sql.annotation.entity.Column("ip")
    String  ip;
    @Column(name = "port", type = MySqlTypeConstant.VARCHAR, length = 5, isNull = false, comment = "端口号")
    @org.beetl.sql.annotation.entity.Column("port")
    String  port;
    @Column(name = "cron", type = MySqlTypeConstant.VARCHAR, length = 20, isNull = false, comment = "随机定时器,默认范围5-15秒，单位秒")
    @org.beetl.sql.annotation.entity.Column("cron")
    String  cron;
    @Column(name = "yesOrNo", type = MySqlTypeConstant.VARCHAR, length = 3, isNull = false, defaultValue = "'Y'", comment = "是否可用")
    @Index(value = "yesOrNo", columns = "yesOrNo")
    @org.beetl.sql.annotation.entity.Column("yesOrNo")
    @Builder.Default
    YesOrNo yesOrNo = YesOrNo.Y;
    @Column(name = "memo", type = MySqlTypeConstant.VARCHAR, length = 200, comment = "备注")
    @org.beetl.sql.annotation.entity.Column("memo")
    String  memo;
}